package com.zq.behavior.memento;

public class Originator {
    private String name;
    private String phone;
    private double budget;

    public Memento saveMemento() {
        Memento memento = new Memento();
        memento.setName(name);
        memento.setPhone(phone);
        memento.setBudget(budget);
        return memento;
    }

    public void restoreMemento(Memento memento) {
        name = memento.getName();
        phone = memento.getPhone();
        budget = memento.getBudget();
    }

    @Override
    public String toString() {
        return "Originator{" +
                "name='" + name + '\'' +
                ", phone='" + phone + '\'' +
                ", budget=" + budget +
                '}';
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public double getBudget() {
        return budget;
    }

    public void setBudget(double budget) {
        this.budget = budget;
    }
}
